<html>
<head>
<link rel="stylesheet" href="page.css" type="text/css">
<title>Documentation: The FXWindow Class</title>
</head>
<body bgcolor=#ffffff link=#990033 vlink=#990033 alink=#990033 text=#000000>

<!---- TOPIC TITLE WITH LOGO--->
<table border=0 cellpadding= cellspacing=2 width=100% ><tr><td><a href='http://www.fox-toolkit.org' target=_top><img src='art/foxlogo_small.jpg' border=0></a></td><td width=100% valign=bottom id="HEADLINE"><b>
Documentation: The FXWindow Class  <A href='window.html' target="_top" align=left><font  size=-2>[Remove Frame]</font></a>
<br><img src='art/line.gif' width=100% height=1></b></td></tr></table>
</p>
<!--- TOPIC TITLE WITH LOGO --->
<ul>
  <p>The FXWindow class manages a window on the screen.  FXWindow is the base class of all FOX GUI
  widgets such as buttons and sliders, in other words, all widgets are ultimately derived from
  FXWindow. All windows are organized into a so called widget tree; at the root of this widget tree
  is the <b>root window</b> which is a special window which represents the entire screen.
  <b>Top level</b> or <b>shell windows</b> are children of the root window; they're special because top level
  windows, such as the <b>main window</b> and <b>dialog box</b>, are positioned and resized
  directly by the user. <b>Layout manager</b> windows are composite windows which may have zero or more children,
  possibly including other layout managers.  Layout managers position their child-windows
  according to certain layout patterns and layout flags.
  <b>Child</b> windows or <b>simple</b> windows are windows which do not themselves have any
  children.  Child windows are usually simple controls such as buttons and sliders.</p>
</ul>


<!--- TOPIC TITLE -->
<p>
<table width=100% cellpadding=0 cellspacing=2><tr><td width=100% valign=bottom id=HEADLINE><b>
Navigating The Widget Tree
<br><img src='art/line.gif' width=100% height=1></b></td></tr></table>
</p>
<!--- TOPIC TITLE -->
<ul>
  <p>As each window is positioned somewhere in the widget tree, each window maintains some information
  about where in the tree it is; this information can be obtained with the following API's:</p>

  <ul>
    <b><u>FXWindow::getParent()</u></b>
    <p>This function returns the window which is this window's immediate parent.  For the root
    window, this returns NULL as the root window does not have a parent.</p>

    <b><u>FXWindow::getRoot()</u></b>
    <p>This function returns the root window, or the window's ultimate parent.</p>

    <b><u>FXWindow::getShell()</u></b>
    <p>This function returns the top level or shell window of this window.  The shell window
    is always a child of the root window.</p>

    <b><u>FXWindow::getOwner()</u></b>
    <p>This returns the window's owner, if any.  The owner of a window is the window that is resposible
    for this window in some way.  For example, a modal dialog may be owned by a main window.
    The system usually ensures that a top level window stays on top of the window that owns it.
    Windows which have no owner return NULL as the owner window.</p>

    <b><u>FXWindow::getFirst()</u></b>
    <p>This returns the first child of this window, if any.</p>

    <b><u>FXWindow::getLast()</u></b>
    <p>This returns the last child of this window, if any.</p>

    <b><u>FXWindow::getNext()</u></b>
    <p>This returns the next sibling of this window.  Use this function to iterate over
    all windows which have a common parent.</p>

    <b><u>FXWindow::getPrev()</u></b>
    <p>This returns the previous sibling of this window.</p>
  </ul>
</ul>

<!--- TOPIC TITLE -->
<p>
<table width=100% cellpadding=0 cellspacing=2><tr><td width=100% valign=bottom id=HEADLINE><b>
Querying Widget Tree Information
<br><img src='art/line.gif' width=100% height=1></b></td></tr></table>
</p>
<!--- TOPIC TITLE -->
<ul>
  <p>There are a number of common questions about the various possible relationships between
  windows in the widget tree.  While it is possible to answer them with the API's above,
  it is cumbersome and so a number of API's are available to make this more easy:<br><br>

  <ul>
    <b><u>FXWindow::isChildOf(window)</u></b>
    <p>Determines if this window is a child of the given window.</p>

    <b><u>FXWindow::containsChild(window)</u></b>
    <p>Determines if this window contains the given window as a child.</p>

    <b><u>FXWindow::containsChild(window)</u></b>
    <p>Determines if this window contains the given window as a child; also returns TRUE
    if the given window is the same as this window.</p>

    <b><u>FXWindow::numChildren()</u></b>
    <p>Returns the number of children of this window by counting them.</p>

    <b><u>FXWindow::indexOfChild(window)</u></b>
    <p>Returns the 0-based position of the given window in this window's list of children.
    If the window is not a child of this window then it returns -1.</p>

    <b><u>FXWindow::childAtIndex(index)</u></b>
    <p>Returns the child window at the given position, or NULL if the index is invalid.</p>

    <b><u>FXWindow::commonAncestor(window1,window2)</u></b>
    <p>This function determines the lowest common ancestor of window1 and window2.</p>
  </ul>

</ul>


<!--- TOPIC TITLE -->
<p>
<table width=100% cellpadding=0 cellspacing=2><tr><td width=100% valign=bottom id=HEADLINE><b>
Primary,Clipboard, Drag and Drop Selections
<br><img src='art/line.gif' width=100% height=1></b></td></tr></table>
</p>
<!--- TOPIC TITLE -->
<ul>
  <p>Many widgets display some data.  For example, a text widget can display some text.
  When the user highlights a range of text, a <b>primary selection</b> is in effect.
  This primary selection can be obtained by other widgets, or even by other programs.
  For instance a selection of some text may be pasted into a terminal by means of the
  middle mouse button under X-Windows (under MS-Windows, the primary selection only
  works within the same FOX program).</p>

  <p>When a selection is <b>copied</b> or <b>cut</b> to the clipboard, a <b>clipboard-selection</b>
  is in effect.  Usually, a clipboard selection is made by <b>Ctrl-C</b> for copy, or
  a <b>Ctrl-X</b> for cut. Again, other widgets or other programs can obtain this data from
  the clipboard.  For instance, an application can obtain the  clipboard selection by
  a <b>paste</b> operation, typically invoked by means of <b>Ctrl-V</b>.</p>

  <p>Finally, when a drag operation is started from this widget, a
  <b>drag-and-drop</b> selection is in effect.
  Drag and drop selections are only in effect while a drag operation is ongoing.
  In contrast, a clipboard or primary selection remains in effect until another
  selection is made (possibly by another application).</p>

  <p>The following API's pertain to the selections:<br><br>
  <ul>
    <b><u>FXWindow::hasSelection()</u></b>
    <p>Return true if this window owns the primary selection.</p>

    <b><u>FXWindow::acquireSelection(types,FXuinumtypes)</u></b>
    <p>Try to acquire the primary selection, given a list of drag types.
    The list of drag types must have been previously registered by means of <a href=app.html>FXApp::registerDragType()</a>.</p>
  </ul>
</ul>

<!--- COPYRIGHT -->
<p>
<table width=100% cellpadding=0 cellspacing=0><tr><td width=100% valign=top id=HEADLINE align=right>
<img src='art/line.gif' width=100% height=1><font size=-1>
Copyright &copy; 1997-2005 Jeroen van der Zijp</font>
</td></tr></table>
</p>
<!--- COPYRIGHT -->


</body>
</html>
